import styles from "../styles/info.module.css";
import Image from "next/image";
import EpisodesButtons from "./buttons";
import { PreFetchVideoLinks } from "../components/cacher";
export default async function DramaInfo({ params }) {
const id = decodeURIComponent(params.id);
const info = await getDramaInfo(id);
PreFetchVideoLinks(info.episodes, id);
return (
{info && (
{/* Drama description */}
Description
{info.description}
{/* Genres */}
Genres:
{info.genres &&
info.genres.map((item, index) => (
{item}
))}
{/* Other names */}
AKA:
{info.otherNames &&
info.otherNames.map((item, index) => (
{item}
))}
{/* Episodes Buttons */}
)}
);
}
async function getDramaInfo(id) {
const res = await fetch(
`https://consumet-jade.vercel.app/movies/dramacool/info?id=${id}`,
{ next: { revalidate: 21600 } }
);
const data = await res.json();
return data;
}